#include<stdio.h>
struct DATE
{
	int year,month,day;
};
int leapyear(int year)
{
	if((year%4==0&&year%100!=0)||(year%400==0))
	{
		return 1;
	}
	return 0;
}
int daysinmonth(int year,int month)
{
	int days[]={0,31,28+leapyear(year),31,30,31,30,31,31,30,31,30,31};
	return days[month];
}
struct DATE addoneday(struct DATE date)
{
	int daysincurrentmonth=daysinmonth(date.year,date.month);
	if(date.day<daysincurrentmonth)
	{
		date.day++;
	}
	else if(date.month<12)
	{
		date.day=1;
		date.month++;
	}
	else
	{
		date.day=1;
		date.month=1;
		date.year++;
	}
	return date;
}
struct DATE adddays(struct DATE date,int k)
{
	for(int i=0;i<k;i++)
	{
		date=addoneday(date);
	}
	return date;
}
void print(struct DATE d)
{
	printf("%d-%d-%d",d.year,d.month,d.day);
}

int main()
{
	struct DATE d1,d2;
    int k;
    scanf("%d %d %d",&d1.year,&d1.month,&d1.day);
    scanf("%d",&k);
    d2=adddays(d1,k);
    print(d2);
    return 0;
}

